Practical Machine Learning with AWS by Himanshu Singh

Practical Machine Learning with AWS by Himanshu Singh

Author:Himanshu Singh
Language: eng
Format: epub
ISBN: 9781484262221
Publisher: Apress


print('Reading input data from {}'.format(input_data_path))

data = pd.read_csv(input_data_path)

data = pd.DataFrame(data=data, columns=columns)

for i in data.Item_Type.value_counts().index:

data.loc[(data['Item_Weight'].isna()) & (data['Item_Type'] == i), ['Item_Weight']] =
data.loc[data['Item_Type'] == 'Fruits and Vegetables', ['Item_Weight']].mean()[0]

cat_data = data.select_dtypes(object)

num_data = data.select_dtypes(np.number)

cat_data.loc[(cat_data['Outlet_Size'].isna()) & (cat_data['Outlet_Type'] == 'Grocery Store'), ['Outlet_Size']] = 'Small'

cat_data.loc[(cat_data['Outlet_Size'].isna()) & (cat_data['Outlet_Type'] == 'Supermarket Type1'), ['Outlet_Size']] = 'Small'

cat_data.loc[(cat_data['Outlet_Size'].isna()) & (cat_data['Outlet_Type'] == 'Supermarket Type2'), ['Outlet_Size']] = 'Medium'

cat_data.loc[(cat_data['Outlet_Size'].isna()) & (cat_data['Outlet_Type'] == 'Supermarket Type3'), ['Outlet_Size']] = 'Medium'



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.